﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace BP.Frm
{
    public partial class FrmSoutez : System.Windows.Forms.Form
    {
        public soutez Souteze { get; set; }
        public FrmSoutez()
        {
            InitializeComponent();
        }

        private void VytvoritSoutezBtnClick(object sender, EventArgs e)
        {
            string i = null;
            foreach (CheckBox c in gb_malorazka.Controls)
            {
                if (c.Checked) 
                    i = i + c.Text + ";";
            }
            foreach (CheckBox c in gb_pistole.Controls)
            {
                if (c.Checked)
                    i = i + c.Text + ";";
            }
            foreach (CheckBox c in gb_puska.Controls)
            {
                if (c.Checked)
                    i = i + c.Text + ";";
            }
            var bp = new BpHelper();
            var disci = new List<string>();
            disci = bp.VypsaniDisciplin(i);

            cb_organizaceSoutez.DataSource = BpHelper.VypsaniOrganizaci();
            
            var frmDiscipliny = new FrmDiscipliny(disci);
            frmDiscipliny.MdiParent = MdiParent;
            frmDiscipliny.Show();

            // vytvoření datového souboru

            string zapis = tb_konani.Text + "!" + tb_hlavniRozhodci.Text + "!"+ tb_kategorie.Text + "!"+ tb_kategorie.Text;
            var cas = DateTime.Today.ToString();
            var strWrite = new StreamWriter("test.txt"); 
            strWrite.Write(zapis);
            strWrite.Close();
        }

        private void FrmSoutezLoad(object sender, EventArgs e)
        {
            cb_organizaceSoutez.DataSource = BpHelper.VypsaniOrganizaci();
        }

        private void CheckBox1CheckedChanged(object sender, EventArgs e)
        {
            gb_pistole.Visible = !gb_pistole.Visible;
        }

        private void ChbMalorazkaCheckedChanged(object sender, EventArgs e)
        {
            gb_malorazka.Visible = !gb_malorazka.Visible;
        }

        private void ChbPuskaCheckedChanged(object sender, EventArgs e)
        {
            gb_puska.Visible = !gb_puska.Visible;
        }
    }
}
